#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <proc/readproc.h>

int main(int argc, char* argv[]) {
    if (argc != 2) {
        fprintf(stderr, "Usage: %s <PID>\n", argv[0]);
        return 1;
    }
    pid_t target_pid = atoi(argv[1]);

    proc_t proc, *proc_ptr = NULL;
    memset(&proc, 0, sizeof(proc));
    // 获取单个进程信息
    proc_ptr = get_proc_stats(target_pid, &proc);
    if (proc_ptr == NULL) {
        fprintf(stderr, "Failed to get process information for PID %d\n", target_pid);
        return 1;
    }
    printf("PID: %d cmd:%s state:%c\n", proc.tid, proc.cmd, proc.state);

    return 0;
}
